package com.yunhe.authority.client.fallback;

import com.yunhe.authority.client.OptionClient;
import com.yunhe.common.model.ResultObject;
import com.yunhe.common.model.base.Area;
import com.yunhe.common.util.FallbackUtil;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class OptionFallbackFactory implements FallbackFactory<OptionClient> {

    @Override
    public OptionClient create(Throwable cause) {
        return new OptionClient() {
            @Override
            public ResultObject<Area> getAreaById(Long id) {
                return FallbackUtil.getDefaultFallBack();
            }

            @Override
            public ResultObject<Area> getAreaByTitle(String title) {
                return FallbackUtil.getDefaultFallBack();
            }
        };
    }
}
